package com.service.impl;

import com.dao.ChatDao;
import com.service.ChatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ChatServiceImpl implements ChatService {
    @Autowired
    private ChatDao dao;

    @Override
    public int insertChat(Integer userId) {
        int count = dao.findChatCount(userId);
        if(count > 0){
            return -1;
        }else{
            String a = "a"+userId;
            count = dao.insertChat(a,userId);
            if(count > 0){
                return count;
            }else{
                return 0;
            }
        }
    }
}
